package UIFree.controls
{
	import UIFree.controls.uif_hscrollArea;
	import UIFree.controls.uif_label;
	import UIFree.uif_component;
	
	import flash.events.Event;
	import flash.geom.Point;
	import flash.geom.Rectangle;

	public class uif_hscrollAreaA extends uif_hscrollArea {
		private var _lCount: uif_label;
		private var _rCount: uif_label;
		private var labelSize: Point = new Point(70, 18);
		
		public function uif_hscrollAreaA(parent:uif_component, ax:int=0, ay:int=0, awidth:int=0, aheight:int=0, 
										styleClass:String='', a_bwidth:int=0, countInfo: Boolean = true) {
			super(parent, ax, ay, awidth, aheight, styleClass, a_bwidth);
			if (countInfo) {
				var iRect: Rectangle = this.displayRect;
				_lCount = new uif_label(this, iRect.x, iRect.y + (iRect.height - labelSize.y) / 2,
										labelSize.x, labelSize.y, 'countLabelL');
				_rCount = new uif_label(this, iRect.x + iRect.width - labelSize.x, iRect.y + (iRect.height - labelSize.y) / 2,
										labelSize.x, labelSize.y, 'countLabelR');
				_lCount.visible = false;
				_rCount.visible = false;
			}
		}
		
		protected function updateLabels(): void {
			if (_lCount) {
				var pa: Array = [this.scrollLeftCount, this.scrollRightCount];
				_lCount.slideVisible(pa[0] > 0);
				_rCount.slideVisible(pa[1] > 0);
				_lCount.text = 'еще ' + String(pa[0]) + ' шт.';
				_rCount.text = 'еще ' + String(pa[1]) + ' шт.';
			}
		}
		
		override protected function updateButtons(): void {
			super.updateButtons();
			updateLabels();
		}
	}
}